*** Settings ***
Documentation     司机线索
Test Setup        common_test_setup    @{driverclue_menu}
Test Teardown     Run Keyword If Test Failed    common_test_teardown
Resource          ../../resource/cluemanage/driverclue_resource.txt
Resource          ../../testdata/${testenv}/cluemanage/driverclue.txt

*** Test Cases ***
create_suc
    [Documentation]    新增司机线索成功
    [Tags]    level1
    ${now}    get time    epoch
    ${name}    catenate    SEPARATOR=_    &{driverclue_create_success}[name]    ${now}
    add_driverclue    ${name}    1${now}    &{driverclue_create_success}[channelsource]    &{driverclue_create_success}[scope]    &{driverclue_create_success}[customtype]    &{driverclue_create_success}[carneedty]
    check_msg    保存成功
    wait_table_loaded
    check_table    &{driverclue_create_success}[check_dic]    \    \    ${name}    公海
    Set Suite Variable    ${driver_cluename}    ${name}

driverclue_modify
    [Documentation]    修改
    [Tags]    level1
    Depends On Test Success    create_suc
    search_driverclue    \    \    ${driver_cluename}    公海
    driverclue_modify    @{driver_modify}[1]
    check_msg    保存成功
    Wait Page Loaded
    check_table    @{driver_modify}[0]    \    \    ${driver_cluename}    公海
    driverclue_common_operate    ${False}    编辑
    Element Text Should Be New    ${loc_industry_select}    @{driver_modify}[1]
    click link new    ${loc_close_modal}

driverclue_allocate
    [Documentation]    分派
    [Tags]    level1
    Depends On Test Success    create_suc
    search_driverclue    \    \    ${driver_cluename}    公海
    driverclue_allocate    @{driverclue_allocate}[1]
    check_msg    保存成功
    wait_table_loaded
    check_table    @{driverclue_allocate}[0]    \    \    ${driver_cluename}    待跟进

driverclue_release
    [Documentation]    释放
    [Tags]    level1    TC-CRM-CM-BVT-01
    Depends On Test Success    driverclue_allocate
    search_driverclue    \    \    ${driver_cluename}    待跟进
    driverclue_release
    wait_table_loaded
    check_table    @{driverclue_release}[0]    \    \    \    公海

driverclue_close
    [Documentation]    关闭线索
    [Tags]    level1
    Depends On Test Success    create_suc
    search_driverclue    \    \    ${driver_cluename}    公海
    driverclue_claim
    wait_table_loaded
    search_driverclue    \    \    ${driver_cluename}    待跟进
    driverclue_close    @{driverclue_close}[1]
    wait_table_loaded
    check_table    @{driverclue_close}[0]    \    \    ${driver_cluename}    已关闭

driverclue_recovery
    [Documentation]    恢复线索
    [Tags]    level1
    Depends On Test Success    driverclue_close
    search_driverclue    \    \    ${driver_cluename}    已关闭
    driverclue_recovery
    wait_table_loaded
    check_table    @{driverclue_recovery}[0]    \    \    ${driver_cluename}    公海

driver_claim
    [Documentation]    认领
    [Tags]    level1
    Depends On Test Success    driverclue_recovery
    search_driverclue    \    \    ${driver_cluename}    公海
    driverclue_claim
    wait_table_loaded
    check_table    @{driver_claim}[0]    \    \    ${driver_cluename}    待跟进

driverclue_follow
    [Documentation]    一般跟进
    [Tags]    level1
    Depends On Test Success    driver_claim
    search_driverclue    \    \    ${driver_cluename}    待跟进
    driverclue_follow    @{driver_follow}[1]    @{driver_follow}[2]    @{driver_follow}[3]    @{driver_follow}[4]
    check_msg    跟进成功
    wait_table_loaded
    check_table    @{driver_follow}[0]    \    \    ${driver_cluename}    跟进中

driverclue_follow_deposit
    [Documentation]    跟进线索至交定金
    [Tags]    level1
    Depends On Test Success    driverclue_follow
    search_driverclue    \    \    ${driver_cluename}    跟进中
    @{l}    evaluate    list(@{driver_follow_deposit})[1:]
    driverclue_follow_deposit    @{l}
    check_msg    保存成功
    wait_table_loaded
    check_table    @{driver_follow_deposit}[0]    \    \    ${driver_cluename}    已转为客户

contract_sign
    [Documentation]    签约
    [Tags]    level1    not run
    Depends On Test Success    driverclue_follow_deposit
    @{l}    evaluate    list(@{driver_contract_sign})[1:]
    ${filepath}    catenate    SEPARATOR=\\    ${EXECDIR}    testdata    ${testenv}    testload.xlsx
    contract_sign    ${filepath}    @{l}
    wait_message_info_loaded
    check_table    @{driver_contract_sign}[0]
